package top.iflyoung.cim.common.util;

import java.util.Collection;
import java.util.Map;

/**
 * @author liguiyang
 * @description
 * @sine 1.8
 * @date 2021/9/223:08
 **/
public class VerifyUtil {
    private VerifyUtil() {
    }

    public static <T> boolean isEmpty(T t) {
        if (null == t) {
            return true;
        }
        if (t instanceof String) {
            return ((String) t).isEmpty();
        }
        if (t instanceof Collection) {
            return ((Collection<?>) t).isEmpty();
        }
        if (t instanceof Map) {
            return ((Map<?, ?>) t).isEmpty();
        }
        if (t.getClass().isArray()) {
            return ((Object[]) t).length == 0;
        }
        return false;
    }
}
